package main

import (
	"fmt"
	"math/rand"
	"strconv"
	"time"
)

func main() {
	//99乘法表
	for i := 1; i < 10; i++ {
		for j := 1; j <= i; j++ {
			c := j * i
			fmt.Printf("%[1]d*%[2]d=%[3]d\t", j, i, c)
		}
		fmt.Println()
	}

	//Fibonacci
	x, y := uint64(0), uint64(1)
	for i := 0; i < 100; i++ {
		x, y = y, x+y
		fmt.Printf("Fibonacci：%d\n", x)
	}

	//随机数
	r := rand.New(rand.NewSource(time.Now().Unix()))
	var str string
	a := 0
	b := 1
	for i := 0; i < 19; i++ {
		nums := r.Intn(20) + 1
		if nums%2 == 0 {
			b = b * nums
		} else {
			a = a + nums
		}
		str += strconv.Itoa(nums) + " "
	}
	num := r.Intn(20)
	str += strconv.Itoa(num)
	fmt.Printf("字符串:%s\n奇数和：%[2]d\n偶数积：%[3]d\n", str, a, b)
}


// 批改意见
// 1. 要求打印100以内的数列，不是要求打印100个数列；
// 2. 随机数数列少于20个，应该是i<=19或i<20；